import { ObjectSystemAttribute } from "../../../Decorator/Decorator";
import { NamedSystemObject } from "../../Object/NamedObject";
import { Entity } from "../Entity/Entity";
import { InstanceQueueIndex } from "./InstanceQueueIndex";
import { ISystemType } from "./ISystemType";

export interface IGetComponentSystem extends ISystemType {

    Run(o: Object, component: Entity): void;

}

export class IGetComponentSystem {

    Run(o: Object, component: Entity): void {

    }

}

@ObjectSystemAttribute()
export abstract class GetComponentSystem<T extends Entity> extends NamedSystemObject implements IGetComponentSystem {

    constructor() {
        super();
    }

    Type() {
        return this.entityType;
    }

    SystemType() {
        return IGetComponentSystem.name;
    }

    GetInstanceQueueIndex(): InstanceQueueIndex {
        return InstanceQueueIndex.None;
    }

    Run(o: Object, component: Entity): void {
        this.GetComponent(<T>o, component);
    }

    abstract GetComponent(self: T, component: Entity): void;

}